//
//  HReducer.h
//  TestOCRedux
//
//  Created by Hotacool on 2019/1/18.
//  Copyright © 2019 Hotacool. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HAction.h"
#import "HState.h"

typedef id<HStateType>(^HReducer)(id<HActionType>, id<HStateType>);


/**
 combine different reducers with related state class name.

 @param dic a dictionary of <state class name, reducer>
 @return a reducer will dispatch action to state-specified sub reducer
 */
HReducer combineReducers(NSDictionary <NSString*, HReducer>*dic);


/**
 generate a reducer using stateClassName to create a state.

 @param arr reducers list
 @param stateClassName strate class name
 @return a reducer which will process action order by reducer list
 */
HReducer appReducer(NSArray <HReducer>*arr, NSString* stateClassName);
